| Conditions | 1 |
| Paths | 1 |
| Total Lines | 33 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | |||
| 18 | let t = '' // output string |
||
| 19 | while (true) { |
||
| 20 | x = txt.indexOf('\n', p) |
||
| 21 | if (x === -1) { |
||
| 22 | // we've not got any more '\n' in the string so complete and exit |
||
| 23 | t = t + txt.substr(p) |
||
| 24 | return t |
||
| 25 | } else if (x === 0 || txt.substr(x - 1, 1) !== '\r') { |
||
| 26 | t = t + txt.substring(p, x) + '\r\n' |
||
| 27 | p = x + 1 |
||
| 28 | } else { |
||
| 29 | t = t + txt.substring(p, x + 1) |
||
| 30 | p = x + 1 |
||
| 31 | } |
||
| 32 | } |
||
| 33 | } else { |
||
| 34 | return txt.replace(/(\r\n)/g, '\n') |
||
| 35 | } |
||
| 36 | } |
||
| 37 |